-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uninstall finds and kills any running elastic-agent watch
process
#3384
Uninstall finds and kills any running elastic-agent watch
process
#3384
Conversation
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
🌐 Coverage report
|
You need to revert 94764be as part of this to see whether it actually fixes the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, maybe needs some testing.
For the testing part I guess we need to create an e2e test that performs an upgrade so that we have the watcher in play, correct ?
Should we also cleanup the Upgrade Marker file when we kill the Upgrade Watcher process? I think it would be good to try and maintain the invariant that the Upgrade Watcher is expected to be running if there's an Upgrade Marker file present. |
This is only called for Uninstall that is removing everything anyway, do we need to specifically remove that file when killing the watcher? |
I am seeing this branch basically get all tests passing on Windows. I am seeing one issue with uninstall where it seems that the Elastic Agent is still running. I think its possible that on Windows that stopping the service doesn't mean that it fully gets stopped (which I believe we have another reported bug about). But I am not getting any issues with the watcher writing to the log file any more. |
True, we don't need to worry about cleaning up the Upgrade Marker file specifically because everything will get cleaned up during Uninstall anyway. I'm working on #2706 and I plan to reuse the work you're doing here over there so I was thinking ahead to that. Don't worry about changing anything in this PR here. I'll add the cleanup if it makes sense when I work on #2706. |
You should be able to revert bf467e3 on this branch as well to confirm that test passes with this fix. |
kind: bug-fix | ||
|
||
# Change summary; a 80ish characters long description of the change. | ||
summary: Uninstall finds and kills any running watcher process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it'd be good to mention the uninstall tracking we well.
// Succeeded step is done and successful. | ||
func (pts *progressTrackerStep) Succeeded() { | ||
prefix := " " | ||
if pts.substeps { | ||
prefix = pts.prefix + " " | ||
} | ||
if !pts.rootstep { | ||
pts.tracker.printf("%sDONE\n", prefix) | ||
} | ||
pts.finalizeFunc() | ||
} | ||
|
||
// Failed step has failed. | ||
func (pts *progressTrackerStep) Failed() { | ||
prefix := " " | ||
if pts.substeps { | ||
prefix = pts.prefix + " " | ||
} | ||
if !pts.rootstep { | ||
pts.tracker.printf("%sFAILED\n", prefix) | ||
} | ||
pts.finalizeFunc() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion]
you could make a function that takes a string (DONE
or FAILED
) and then Succeeded
and Failed
call it with the right string.
but the chance someone will need to change either Succeeded
or Failed
and forget the other is small, so it's realy up to you
stack never became ready, I will try again |
buildkite test this |
1 similar comment
buildkite test this |
Tested the progress checker changes in this PR. I like how this looks!
I have two concerns:
|
@cmacknz specifically asked for this information to be added, so its clear that a watcher was running and what PID was killed. I think overall its good to see, even if its implementation detail.
Yeah I think we would need switch from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Progress tracker related changes LGTM!
This pull request is now in conflicts. Could you fix it? 🙏
|
seems the stack was either removed mid test or was never really ready, trying again... |
buildkite test this |
@blakerouse Could we backport this PR to |
…3384) * kill watcher on uninstall * Empty commit. * Fix killWatcher. * Empty commit. * Another fix for killWatcher. * Empty commit. * Catch ErrProcessDone. * Empty commit. * Empty commit * Add changelog fragment. * Make it work on Windows. * Change killWatcher to be in a loop. * Add loop to killWatcher. * Revert "Skip TestStandaloneUpgradeFailsStatus to fix failing integration tests again (#3391)" This reverts commit bf467e3. * Revert "Fix integration tests by waiting for the watcher to finish during upgrade tests (#3370)" This reverts commit 94764be. * Fix test. * Revert "Revert "Skip TestStandaloneUpgradeFailsStatus to fix failing integration tests again (#3391)"" This reverts commit 3b0f040. * Add progress tracking for uninstall like install. * Log when no watchers our found. * Improve uninstall. * Fix data race. (cherry picked from commit 7e86d24) # Conflicts: # internal/pkg/agent/cmd/install.go # internal/pkg/agent/install/install.go # internal/pkg/agent/install/progress.go # internal/pkg/agent/install/progress_test.go
@ycombinator Yes, backporting it now. |
@ycombinator Actually this cannot be backported without backporting the work you did to add the installation output in 8.11. This work is based off of that. We can either backport that one as well, or not backport this one. Only backport the @cmacknz your opinion as well? |
I'm in favor of this as the installation output work is an enhancement (not a bugfix). |
Agreed. I will just add the |
What does this PR do?
Finds any running
elastic-agent watch
process on the host and kills the running watcher.Adds console output for uninstall so its clear to see what uninstall is performing.
Why is it important?
Fixes the following problems:
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added tests that prove my fix is effective or that my feature works./changelog/fragments
using the changelog toolHow to test this PR locally
sudo elastic-agent uninstall
to get it to fully uninstall.Related issues
Logs
After Upgrade:
After Uninstall:
Uninstall output: